package com.bupt.dao;


import com.bupt.bean.Event;
import com.bupt.config.ResultCode;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;
import java.util.Map;


public interface EventRepository extends JpaRepository<Event,String>, JpaSpecificationExecutor<Event> {


     public Event findByDeviceId(String deviceId);

     public Event findByEventId(Integer eventId);

     public List<Event> findAllByOrderByEventIdDesc();

     @Query(value = "SELECT  * FROM event_t",nativeQuery = true)
    List<Map<String,Object>> findAllPage(Pageable pageable);


     int countByStatus(int status);

//    ResultCode editEventStatus();
}
